﻿package net.wangit.view.unit.combine;

import net.wangit.MapList;
import net.wangit.context.ActionContext;
import net.wangit.util.Checker;
import net.wangit.util.StringUtil;
import net.wangit.view.unit.UnitComponent;

public class CombineProcessor {

	public CombineProcessor() {
	}

	public static void combine(ActionContext ac, UnitComponent uc) {
		String rowCombine = uc.getRowCombine();
		if (Checker.isEmpty(rowCombine))
			return;
		MapList data = uc.getData();
		if (Checker.isEmpty(data))
			return;
		int end = data.size() - 1;
		String rowCombines[] = StringUtil.split(rowCombine, ";");
		for (int i = 0; i < rowCombines.length; i++) {
			CombineElement ce = new CombineElement(uc, rowCombines[i]);
			ce.combine(data, 0, end);
		}

	}
}
